package fr.labri.macchiato.framework.technical.encoder;

import java.util.List;

/**
 * @author Matthieu Foucault
 *
 * Simple interface for an encoder
 *
 * @param <T>
 *  The class to encode/decode
 */
public interface Encoder<T> {

	/**
	 * Encodes the given object to a JSON String
	 * @param object
	 * @return a JSON String corresponding to the object
	 */
	String encode(T object);

	/**
	 * Decodes the given JSON String into a java object
	 * @param jsonString
	 * @return An object corresponding to the JSON String
	 */
	T decode(String jsonString);
	
	/**
	 * Decodes a JSON String returned as result of a Sparql query 
	 * @param jsonString
	 * @return a list of java objects corresponding to the JSON String
	 */
	List<T> decodeSparqlResult(String jsonString);

}
